{extend name="default/template/base_index" /}


{block name="area_header"}
<link rel="stylesheet" type="text/css" media="all" href="__CDN__/jquery-datetimepicker/jquery.datetimepicker.css">
<script type="text/javascript" src="__CDN__/jquery-datetimepicker/jquery.datetimepicker.js"></script>
<link type="text/css" rel="stylesheet" href="__CDN__/select2/4.0.0/css/select2.min.css" />
<link type="text/css" rel="stylesheet" href="__CDN__/select2/4.0.0/css/cosmo-skin.css" />
<style type="text/css">
    .vertical-align-middle>td{
        vertical-align: middle!important;
    }
</style>
{/block}

{block name="area_body"}
    {include file="default/Widget/topbar" /}
    <div class="admin-main container-fluid">
        {include file="default/Widget/left" /}
        <div class="admin-main-content">
            {include file="default/Widget/breadcrumb" /}
            <div class="h4">提现历史查询</div>

            <div class="filter-controls">
                <form class="form-inline searchForm" method="post" action="{:url('Withdraw/query')}">
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon"><i class="fa fa-user"></i>提现用户</div>
                            <select id="user_select2" name="uid" style="width: 360px;">
                                {if condition="$uid gt 0"}<option value='{$uid}' selected="selected">[id:{$uid}] {$nickname}</option>{/if}
                            </select>
                        </div>
                    </div>
                    <div class="form-group ">
                        <div class="input-group">
                            <div class="input-group-addon">提现状态 </div>
                            <div class="margin-sm">
                                <label class="radio-inline">
                                    <input type="radio" class="j_radio_status" name="valid_status" {eq name="valid_status" value=""}checked{/eq}  value=""> 不限
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" class="j_radio_status" name="valid_status" {eq name="valid_status" value="1"}checked{/eq}   value="1"> 通过
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" class="j_radio_status" name="valid_status" {eq name="valid_status" value="2"}checked{/eq}  value="2"> 驳回
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" class="j_radio_status" name="valid_status" {eq name="valid_status" value="0"}checked{/eq}   value="0"> 待审核
                                </label>
                            </div>
                          </div>
                    </div>
                    <div class="form-group ">
                        <div class="input-group">
                            <div class="input-group-addon">时间<i class="fa fa-calendar"></i></div>
                            <input type="text" name="startdatetime" id="startdatetime" class="form-control input-short" value="{:date('Y-m-d H:i:s',$startdatetime)}" />
                            <div class="input-group-addon">
                                <i class="fa fa-long-arrow-right"></i>
                            </div>
                            <input type="text" name="enddatetime" id="enddatetime" class="form-control input-short" value="{:date('Y-m-d H:i:s',$enddatetime)}" />
                        </div>
                        <button type="submit" class="btn btn-default"><i class="fa fa-search"></i>{:L('BTN_SEARCH')}</button>
                    </div>
                </form>
            </div>

            <div class="table-responsive">
                <table class="table table-bordered table-striped table-condensed table-hover table-condensed">
                     <thead>
                      <th>申请记录ID</th>
                      <th>提现用户头像/昵称(id)</th>
                      <th>提现用户手机号</th>
                      <th>提现类型/账号</th>
                      <th>开户行</th>
                      <th>提现金额</th>
                      <th>提现信息</th>
                      <th>申请提现时间</th>
                      <th>操作人</th>
                      <th>操作人回复信息</th>
                      <th>提现状态</th>
                    </thead>
                    <tbody>
                    {empty name="list"}
                    <tr>
                        <td colspan="9" class="text-center">{:L('NO_DATA')}</td>
                    </tr>
                    {else/}
                    {volist name="list" id="vo"}
                    <tr class="vertical-align-middle">
                    	<td>{$vo.id}</td>
                        <td>
                            <a href="{:url('Member/view',array('id'=>$vo['uid']))}">
                            <img class="m-avatar" src="{:app\\src\\base\\helper\\ConfigHelper::getAvatarUrl($vo['uid'],60)}" />
                            {$vo.nickname|default='--'}({$vo.uid})
                            </a>
                        </td>
                        <td>{$vo.mobile}</td>
                        <td>
                        {notempty name="vo.wa_extra"}
                        {$vo.wa_extra}<br/>
                        <span class="text-warning">{$vo.account}</span>
                        {else /}
                        <span class="text-danger">此提现账号已被删除</span>
                        {/notempty}
                        </td>
                        <td>
                            {notempty name="vo.open_bank"}
                                {$vo.open_bank}
                            {else /}
                                <span class="label-danger" style="color: #ffffff;">【缺失】</span>
                            {/notempty}
                        </td>
                        <td>{:number_format($vo.money/100.0,2,".","")}</td>
                        <td>{$vo.reason}</td>
                        <td>{:date("Y-m-d H:i:s",$vo['create_time'])}</td>
                        <td>
                            {if condition=" $vo['op_uid'] gt 0 " }
                            <a href="{:url('Member/view',array('id'=>$vo['op_uid']))}">
                                <img class="m-avatar" src="{:app\\src\\base\\helper\\ConfigHelper::getAvatarUrl($vo['op_uid'],60)}" />
                                {$vo.op_nickname|default='--'}({$vo.op_uid})
                            </a>
                            {else/}
                            --
                            {/if}
                        </td>
                        <td>{$vo.reply_msg|default='--'}</td>
                        <td>

                            {switch name="vo['valid_status']"}
                            {case  value="0" }<span class="label label-default">待审核</span>{/case}
                            {case  value="1"}<span class="label label-success">已通过</span>{/case}
                            {case  value="2"}<span class="label label-danger">已驳回</span>{/case}
                            {default /}--
                            {/switch}
                        </td>
                    </tr>
                    {/volist}
                    {/empty}
                    </tbody>
                </table>
                <div>{$show}</div>
            </div>

        </div>
        <!-- END admin-main-content -->
    </div>
    <!-- END admin-main-->
{/block}

{block name="area_footer"}
    <script src="__CDN__/select2/4.0.0/js/select2.min.js"></script>
    <script src="__CDN__/select2/4.0.0/js/i18n/zh-CN.js"></script>
    <script type="text/javascript">
        $(function(){
            $(".j_radio_status").click(function(){
                $(".searchForm").submit();
            });
            $('#startdatetime').datetimepicker({
                lang: 'ch',
                format:'Y-m-d',
                timepicker:false,
            });
            $('#enddatetime').datetimepicker({
                lang: 'ch',
                format:'Y-m-d',
                timepicker:false,
            });
            $(".status").click(function(){
                $(".searchForm").submit();
            })
            $("#user_select2").select2({
                placeholder: "输入用户id或昵称查询"	,
                language: "zh-CN",
                ajax: {
                    url: "{:url('Member/select')}",
                    dataType: 'json',
                    delay: 250,
                    data: function (params) {
                        var queryParameters = {
                            q: params.term
                        }
                        return queryParameters;

                    },
                    processResults: function (result, page) {
                        if(!result.data){
                            result.data = new Array();
                            result.data['nodata']="无相关数据";
                        }
                        // parse the results into the format expected by Select2.
                        // since we are using custom formatting functions we do not need to
                        // alter the remote JSON data
                        return {
                            results: result.data
                        };
                    },
                    cache: true
                },
                minimumInputLength: 0,
                templateSelection: function (repo) {
                    return repo.nickname ? '[id:'+repo.id+'] '+repo.nickname: repo.text;
                },
                templateResult: function (repo) {

                    if (repo.loading) return repo.text;
                    if(repo.nodata) return repo.nodata;
//    				var markup = '<div>'+repo.nickname+'</div>';
                    var markup = '<div><img class="m-avatar" src="'+repo.head+'" style="width:30px;height:30px;"/>[id:'+repo.id+'] '+repo.nickname+'</div>';
                    return $(markup);
                },
            });
        });
    </script>
{/block}